﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace RenShiKaoQin.Account
{
    public partial class KQExport : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isKQY = Session["IsKQY"] != null ? (bool)Session["IsKQY"] : false;
            if (!isKQY)
            {
                Response.Write("您无权查看此页面");
                Response.End();
            }
            tbStart.Attributes["readonly"] = "readonly";
            tbEnd.Attributes["readonly"] = "readonly";
            hfDeptCode.Value = Request["DeptCode"];
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            if (hfDeptCode.Value == null || hfDeptCode.Value == "") return;
            string deptCode = hfDeptCode.Value;
            sqlKQExport.SelectParameters.Clear();
            sqlKQExport.SelectParameters.Add("StartDate", TypeCode.DateTime, tbStart.Text);
            sqlKQExport.SelectParameters.Add("EndDate", TypeCode.DateTime, tbEnd.Text);
            sqlKQExport.SelectParameters.Add("DeptCode", TypeCode.String, deptCode);
        }

        protected void btnExport_Click(object sender, EventArgs e)
        {
            Bussiness.ExcelHelper.GridViewtoExcel(gvKQExport, "KQExport.xls");
        }
    }
}